package com.design.myiterator.football;

import java.util.List;

/**
 * @author xiemiao
 * @description
 * @date 2023/08/17
 */
public class PlayerIterator<T> implements Iterator<T> {

    private List<T> items;

    private int position = 0;

    public PlayerIterator(List<T> items) {
        this.items = items;
    }

    @Override
    public boolean hasNext() {
        return items.size() > position;
    }

    @Override
    public T next() {
        T t = items.get(position);
        position++;
        return t;
    }
}
